#include <iostream>
#include <cmath>
using namespace std;

int main() {
    int n;
    cin >> n;
    int* a = new int(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int summ=0;
    //int* sum = new int(pow(2, n));
    for (unsigned int i = 0; i < pow(2, n); i++) {
        //sum[i] = 0;
        int sum=0;
        int count = 0;
        unsigned long b = pow(2, n - 1);
        for (int j = 0; j < n; j++) {
            if ((i & b) != 0) {
                count++;
                //sum[i] += count * a[j];
                sum += count * a[j];
            }
            b >>=1;
        }
        summ=summ^sum;
    }
    // int summ = sum[0];
    // for (int i = 1; i < pow(2, n); i++) {
    //     summ = summ^sum[i];
    // }
    cout << summ;
}